package com.hu.service;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import junit.framework.TestCase;

@RunWith(value = SpringJUnit4ClassRunner.class)
@ContextConfiguration(value = "classpath:applicationContext.xml")
public class TestServiceImplTest extends TestCase {
	@Autowired
	private TestService testService;

	@Test
	public void testShowTest() {
		System.out.println("hello");
		try {
			List<com.hu.bean.Test> list = testService.showTest();
			System.out.println(list.size());
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	@Test
	public void testInsert() {
		com.hu.bean.Test test = new com.hu.bean.Test();
		test.setId("d");
		test.setName("c");
		com.hu.bean.Test test2 = new com.hu.bean.Test();
		test2.setId("a");
		test2.setName("b");
		testService.insert(test);
		testService.insert(test2);
	}

	@Test
	public void testDelete() {
		String id = "a";
		testService.delete(id);
	}

	@Test
	public void testFindOne() {
		String id = "b";
		com.hu.bean.Test test = testService.findOne(id);
		System.out.println(test);
	}

	@Test
	public void testUpdate() {
		String id = "b";
		com.hu.bean.Test test = testService.findOne(id);
		test.setName("test");
		testService.update(test);
	}

}
